/**
 * 
 */
package design_pattern.proxy.example1;

/**
 * @author linzq
 * 
 */
public class ProxySubject implements Subject {

  private RealSubject realSubject;

  @Override
  public void request() {
    preRequest();
    if (realSubject == null) {
      realSubject = new RealSubject();
    }
    realSubject.request();
    postRequest();
  }

  public void preRequest() {
    System.out.println("Preview Request.");
  }

  public void postRequest() {
    System.out.println("post Request.");
  }
}
